# Maintainer: Noel Kuntze <noel.kuntze@contauro.com>
pkgname=py3-falcon
pkgdesc="Web API framework for fast and reliable microservices, proxies, and app backends"
pkgver=3.1.3
pkgrel=0
arch="all"
url="https://falconframework.org/"
license="Apache-2.0"
makedepends="
	py3-gpep517
	py3-setuptools
	py3-wheel
	python3-dev
	cython
	"
checkdepends="
	py3-coverage
	py3-pytest
	py3-pyaml
	py3-requests
	py3-pytest-asyncio
	py3-aiofiles
	py3-httpx
	uvicorn
	py3-websockets
	py3-cbor2
	py3-msgpack
	py3-mujson
	py3-ujson
	py3-rapidjson
	py3-orjson
	py3-gunicorn
	py3-daphne
	py3-waitress
	"

subpackages="$pkgname-pyc"

source="$pkgname-$pkgver.tar.gz::https://github.com/falconry/falcon/archive/refs/tags/$pkgver.tar.gz
	python-3.12.patch
	"

builddir="$srcdir"/falcon-$pkgver

build() {
	gpep517 build-wheel \
		--wheel-dir dist \
		--output-fd 3 3>&1 >&2
}

check() {
	local _site_packages=$(python -c "import site; print(site.getsitepackages()[0])")
	python3 -m installer -d test_dir dist/*.whl
	export PYTHONPATH="$PWD/test_dir/$_site_packages:$PYTHONPATH"
	pytest -vv tests/
}

package() {
	python3 -m installer -d "$pkgdir" dist/*.whl
}

sha512sums="
66c5f563b373eb2bc2576d64d2225fa98f4d9d80dc1c93f6831f17287738797ac1f08a1ba71f4a70e6bafad7a51f70fa6fbbee99ef521419ceedcf2d892108ee  py3-falcon-3.1.3.tar.gz
c9b7eb3058df517e7880584292b9a46415f437c9cddff8ddab8d1bcb7cf0e2cc5ef8ebd6e4c5ad2dd243aefc02e4664a91a885cc15b7c97e75ba430bfa669e95  python-3.12.patch
"
